package edu.hawaii.senin.iclouds.basics;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
 * Tests for the Interval class.
 * 
 * @author Pavel Senin.
 * 
 */
public class TestInterval {

  private static final Interval interval = new Interval("dull", 0.23D, 0.71D);

  /**
   * Tests within operation.
   * 
   */
  @Test
  public void testWithin() {
    assertFalse("Testing within interval", TestInterval.interval.within(0.2299999D));
    assertTrue("Testing within interval", TestInterval.interval.within(0.2300001D));
    assertTrue("Testing within interval", TestInterval.interval.within(0.7099999D));
    assertFalse("Testing within interval", TestInterval.interval.within(0.7100001D));
  }

  /**
   * Tests LowBound stuff.
   * 
   */
  @Test
  public void testGetLowBound() {
    assertEquals("Testing low bound", 0.23D, interval.getLowBound());
  }

  /**
   * Tests High bound stuff.
   * 
   */
  @Test
  public void testGetHighBound() {
    assertEquals("Testing high bound", 0.71D, interval.getHighBound());
  }

}
